module.exports = app => {
    const { router, controller, middleware, config } = app;
    const jwt = middleware.jwt(config.jwt.secret);
    // /view/XXX 页面数据相关
    router.get('/view/opts', controller.front.view.opts);
    router.get('/view/dicts', controller.front.view.dicts);
    router.get('/view/brands', controller.front.view.brands);
    router.get('/view/address', controller.front.view.address);

    // /goods/XXX 商品数据相关
    router.get('/goods/newest', controller.front.goods.newest);
    router.get('/goods/hotest', controller.front.goods.hotest);
    router.get('/goods/byBrandSeries', controller.front.goods.byBrandSeries);
    router.get('/goods/detail', controller.front.goods.detail);
    router.get('/goods/params', controller.front.goods.params);
    router.get('/goods/comment', controller.front.goods.comment);
    router.get('/goods/search/byWords', controller.front.goods.searchByWords);
    router.get('/goods/search/byOpts', controller.front.goods.searchByOpts);
    router.get('/goods/shopCart', controller.front.goods.shopCart);
    router.get('/goods/shopCart/add', controller.front.goods.shopCartAdd);
    router.get('/goods/shopCart/out', controller.front.goods.shopCartOut);
    router.get('/goods/deal', controller.front.goods.deal);

    // /user/XXX 用户数据相关
    router.post('/user/regist', controller.front.user.regist);
    router.post('/user/login', controller.front.user.login);
    router.post('/user/autoLogin', jwt, controller.front.user.login);
    router.get('/user/out', controller.front.user.out);
    router.get('/user/get/voucher', controller.front.user.getVoucher);
    router.get('/user/update/avatar', controller.front.user.updateAvatar);
    router.get('/user/update/info', controller.front.user.updateInfo);
};